package xyz.xiaoshengfu.xrpc.spring;

import org.springframework.beans.factory.xml.NamespaceHandlerSupport;

import xyz.xiaoshengfu.xrpc.config.ApplicationConfig;
import xyz.xiaoshengfu.xrpc.config.ProtocolConfig;
import xyz.xiaoshengfu.xrpc.config.ReferenceBean;
import xyz.xiaoshengfu.xrpc.config.RegistryConfig;
import xyz.xiaoshengfu.xrpc.config.ServiceBean;

/**
 * <p>Title: XRpcNamespaceHandler</p>
 * <p>Description: 与Spring深度整合的配置文件处理类</p>
 * @author xiaoshengfu(2439323118@qq.com)
 * @date 2020年3月24日
 */
public class XRpcNamespaceHandler extends NamespaceHandlerSupport {

	@Override
	public void init() {
		registerBeanDefinitionParser("application", new XRpcBeanDefinitionParser(ApplicationConfig.class));
		registerBeanDefinitionParser("registry", new XRpcBeanDefinitionParser(RegistryConfig.class));
		registerBeanDefinitionParser("protocol", new XRpcBeanDefinitionParser(ProtocolConfig.class));
		registerBeanDefinitionParser("service", new XRpcBeanDefinitionParser(ServiceBean.class));
		registerBeanDefinitionParser("reference", new XRpcBeanDefinitionParser(ReferenceBean.class));
	}

}